package com.tianql.controller;

import com.tianql.config.DogConfig;
import com.tianql.core.ApiResult;
import com.tianql.service.AccountServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 田起立
 * @Date 2024/6/11 16:03
 * @Description:
 */
@RestController
@RequestMapping("/account")
@RefreshScope
public class AccountController {
    @Autowired
    private AccountServiceImpl accountService;
    @Autowired
    private DogConfig dogConfig;

    @PostMapping("debit")
    public String debit(@RequestParam("userId") String userId, @RequestParam("money") int money) {
        return accountService.debit(userId, money);
    }
    @GetMapping("getDog")
    public ApiResult debit() {
        return new ApiResult(200,"账户配置",dogConfig);
    }
}
